<?php
/**
 * ClassDescription
 * @category Category
 * @author   邱阿朋 <qiuapeng921@163.com>
 * @Date     2019/06/01 21:37
 */

namespace app\api\validate;


use think\Validate;

class UserValidate extends Validate
{
    protected $rule = [
        'username' => 'require|max:14',
        'password' => 'require|max:20',
        'email'    => 'email',
    ];

    protected $message = [
        'username.require' => '用户名不能为空',
        'username.max'     => '用户名最大不能超过14位',
        'password.require' => '密码不能为空',
        'password.max'     => '密码不能超过20位',
        'email'            => '邮箱格式不对'
    ];

    protected $scene = [
        'login'    => ['username', 'password'],
        'register' => ['username', 'password', 'email', 'code'],
        'update'   => ['username', 'password'],
    ];
}